package com.example.builder;

public class User {

    private final String firstName;

    private final String lastName;

    public User(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {

        String firstName;
        String lastName;

        public Builder firstName(String value) {
            this.firstName = value;
            return this;
        }

        public Builder lastName(String value) {
            this.lastName = value;
            return this;
        }

        public User build() {
            return new User(firstName, lastName);
        }
    }


    public static void main(String[] args) {

        User user = new User.Builder().firstName("12312")
                .lastName("asdasd")
                .build();

    }
}